<?php
include('session.php');
include('../Config/conn.php');

for($i = 1;$i <=12;$i++){
if ($status == 0){    
$sql = "SELECT sum(money) AS count FROM pay_log WHERE MONTH(time)='$i' and year(time) = year(now())";
}else{
$sql = "SELECT sum(money) AS count FROM pay_log WHERE MONTH(time)='$i' and year(time) = year(now()) AND code='$code' and fuser=''";    
}
$result=mysql_query($sql);
if ($result){
$a=mysql_fetch_array($result);
$num= $a['count'];
if($num==null){
    $num=0;
}

$c[]=$num;

}
}
for($i = 1;$i <=31;$i++){
if ($status == 0){    
$sql = "SELECT sum(money) AS count FROM pay_log WHERE MONTH(time)=MONTH(now()) and year(time) = year(now()) and day(time) = $i";
}else{
$sql = "SELECT sum(money) AS count FROM pay_log WHERE MONTH(time)=MONTH(now()) and year(time) = year(now()) and day(time) = $i and code='$code' and fuser=''";    
}
$result=mysql_query($sql);
if ($result){
$a=mysql_fetch_array($result);
$num= $a['count'];
if($num==null){
    $num=0;
}
$d[]=$num;
}
}
?>